<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        //浏览器返回的都是字符串

        var num = prompt('请输入你的年龄');
        console.log(typeof num);   //String


        console.log(parseInt('3.14'))     //3
        console.log(parseInt('3.94'))     //3   不会四舍五入
        console.log(parseInt('120px'))    //120
        console.log(parseInt('rem120'))   //NaN

        console.log(parseFloat('3.14'))     //3.14
        console.log(parseFloat('3.94'))     //3.94
        console.log(parseFloat('120px'))    //120
        console.log(parseFloat('rem120'))   //NaN


        console.log(Number('12'));

        var num1=prompt('请输入第一个数:');
        var num2=prompt('请输入第二个数:');
        var num3=parseFloat(num1)+parseFloat(num2);
        alert(num3)


    </script>
</head>
<body>

</body>
</html>